#include "../Libraries/UnitTest/UnitTest++.h"
#include "../Libraries/String/String.h"


using namespace UnitTest;

namespace {

TEST (StringIsEmptyByDefault)
{
    String str;
    CHECK ( str.length() == 0 );
}

TEST (StringLogicalEquals)
{
	String dog("dog");
	CHECK ( dog == "dog" );
	CHECK ( !(dog == "cat") );
}

TEST (StringCopyConstructor)
{
	String str("original");
	String copy(str);
	CHECK ( copy == str );
}

TEST (StringReverse)
{
	String cat("tac");
	cat.reverse();
	CHECK ( cat == "cat" );
}

TEST (StringIntConversionConstructor)
{
	String str(10);
	CHECK (str == "10");
}

TEST (StringFloatConversionConstructor)
{
	String str[] = {
		String( 1.5f ),
		String( 1.25f ),
		String( 1.0023f ),
		//String( 12340.054f )
		};

	CHECK ( str[0] == "1.5" );
	CHECK ( str[1] == "1.25" );
	CHECK ( str[2] == "1.0023" );
}


TEST (StringConcatinate)
{
	String dog("dog");
	String cat("cat");
	String dogcat = dog + cat;

	CHECK ( dogcat == "dogcat" );
}

TEST (StringBoolConversionConstructor)
{
	String str(false);
	CHECK ( str == "false" );
	String str2(true);
	CHECK ( str2 == "true" );
}

TEST (StringIndexOperator)
{
	String abc("abCdefg");
	CHECK ( abc[2] == 'C' );
}

TEST (StringLength)
{
	String length("Length");
	CHECK ( length.length() == 6 );
}

TEST (StringLower)
{
	String low("THIS IS A TEST");
	low.lower();
	CHECK ( low == "this is a test" );
}

TEST (StringUpper)
{
	String up("this is a test");
	up.upper();
	CHECK ( up == "THIS IS A TEST" );
}

TEST (StringPropper)
{
	String prop("this IS a TEST");
	prop.propper();
	CHECK ( prop == "This Is A Test" );
}

}
